package com.fire.service.impl;

import java.sql.SQLException;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.fire.bo.coupon.req.CouponReq;
import com.fire.bo.coupon.req.CouponReqAdd;
import com.fire.bo.coupon.req.DelCouponReq;
import com.fire.bo.coupon.req.SelCouponReq;
import com.fire.bo.coupon.res.CouponRes;
import com.fire.dao.CouponDao;
import com.fire.service.CouponService;

@Service
public class CouponServiceImpl implements CouponService
{
	
	@Autowired
	private CouponDao couponDao;
	
	@Override
	public void addCoupon(CouponReqAdd bean) throws SQLException
	{
		couponDao.addCoupon(bean);
	}

	@Override
	public void updateCoupon(CouponRes bean) throws SQLException
	{
		couponDao.updateCoupon(bean);
	}

	@Override
	public void delCoupon(DelCouponReq bean) throws SQLException
	{
		couponDao.delCoupon(bean);
	}

	@Override
	public List<CouponReq> selCoupon(SelCouponReq bean) throws SQLException
	{
		bean.setPage((bean.getPage() - 1) * bean.getPageSize());
		return couponDao.selCoupon(bean);
	}

	@Override
	public CouponRes selCouponById(DelCouponReq bean) throws SQLException
	{
		return couponDao.selCouponById(bean);
	}

	@Override
	public int selCouponCount(SelCouponReq bean) throws SQLException {
		return couponDao.selCouponCount(bean);
	}

}
